import { Controller, Get, Post, Body, Put, Param, Delete, UseGuards } from '@nestjs/common';
import { ShopsService } from './shops.service';
import { CreateShopDto } from './dto/create-shop.dto';
import { UpdateShopDto } from './dto/update-shop.dto';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';

@ApiTags('shops')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Controller('shops')
export class ShopsController {
  constructor(private readonly shopsService: ShopsService) {}

  @Post()
  @ApiOperation({ summary: '创建商店' })
  create(@Body() createShopDto: CreateShopDto) {
    return this.shopsService.createShop(createShopDto);
  }

  @Get()
  @ApiOperation({ summary: '获取所有商店' })
  findAll() {
    return this.shopsService.findAll();
  }

  @Get(':id')
  @ApiOperation({ summary: '获取指定商店' })
  findOne(@Param('id') id: string) {
    return this.shopsService.findOne(+id);
  }

  @Put(':id')
  @ApiOperation({ summary: '更新商店信息' })
  update(@Param('id') id: string, @Body() updateShopDto: UpdateShopDto) {
    return this.shopsService.updateShop(+id, updateShopDto);
  }

  @Delete(':id')
  @ApiOperation({ summary: '删除商店' })
  remove(@Param('id') id: string) {
    return this.shopsService.deleteShop(+id);
  }
} 